Algoritmo de Dijkstra

Todos os passos

flowchart LR
	a:::visited -->|2| b
	a -->|1| c
	b -->|1| d
	c-->|3| d
	c-->|4|e
	d--->|2|f
	e-->|2|f

	classDef visited fill:#f96,color:#000000
iter visitado a b c d e f
a (0,-) (2,a) (1,a)
flowchart LR
	a:::visited -->|2| b
	a -->|1| c
	b -->|1| d
	c:::visited -->|3| d
	c-->|4|e
	d--->|2|f
	e-->|2|f

	classDef visited fill:#f96,color:#000000
iter visitado a b c d e f
a (0,-) (2,a) (1,a)
c (0,-) (2,a) (1,a) (4,c) (5,c)
flowchart LR
	a:::visited -->|2| b
	a -->|1| c
	b:::visited -->|1| d
	c:::visited -->|3| d
	c-->|4|e
	d--->|2|f
	e-->|2|f

	classDef visited fill:#f96,color:#000000
iter visitado a b c d e f
a (0,-) (2,a) (1,a)
c (0,-) (2,a) (1,a) (4,c) (5,c)
b (0,-) (2,a) (1,a) (3,b) (5,c)
flowchart LR
	a:::visited -->|2| b
	a -->|1| c
	b:::visited -->|1| d
	c:::visited -->|3| d
	c-->|4|e
	d:::visited--->|2|f
	e-->|2|f

	classDef visited fill:#f96,color:#000000
iter visitado a b c d e f
a (0,-) (2,a) (1,a)
c (0,-) (2,a) (1,a) (4,c) (5,c)
b (0,-) (2,a) (1,a) (3,b) (5,c)
d (0,-) (2,a) (1,a) (3,b) (5,c) (5,d)
flowchart LR
	a:::visited -->|2| b
	a -->|1| c
	b:::visited -->|1| d
	c:::visited -->|3| d
	c-->|4|e
	d:::visited--->|2|f
	e:::visited-->|2|f

	classDef visited fill:#f96,color:#000000
iter visitado a b c d e f
a (0,-) (2,a) (1,a)
c (0,-) (2,a) (1,a) (4,c) (5,c)
b (0,-) (2,a) (1,a) (3,b) (5,c)
d (0,-) (2,a) (1,a) (3,b) (5,c) (5,d)
e (0,-) (2,a) (1,a) (3,b) (5,c) (5,d)
f (0,-) (2,a) (1,a) (3,b) (5,c) (5,d)
flowchart LR
	a:::visited -->|2| b
	a -->|1| c
	b:::visited -->|1| d
	c:::visited -->|3| d
	c-->|4|e
	d:::visited--->|2|f
	e:::visited-->|2|f
	f:::visited
	classDef visited fill:#f96,color:#000000
iter visitado a b c d e f
a (0,-) (2,a) (1,a)
c (0,-) (2,a) (1,a) (4,c) (5,c)
b (0,-) (2,a) (1,a) (3,b) (5,c)
d (0,-) (2,a) (1,a) (3,b) (5,c) (5,d)
e (0,-) (2,a) (1,a) (3,b) (5,c) (5,d)
f (0,-) (2,a) (1,a) (3,b) (5,c) (5,d)

Resposta menor custo

Rota de A até F = A->B->D->F